package com.seleniti.pozit.web.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.grupit.api.core.common.exception.AgentLocatorCollectionException;
import com.grupit.api.core.common.exception.InvalidCapabilityActionIdException;
import com.grupit.api.core.ui.pluggablefeatures.tools.AgentLocatorCollection;
import com.grupit.api.core.ui.pluggablefeatures.tools.PluggableFeatureAgent;
import com.grupit.api.core.ui.pluggablefeatures.tools.UserWebAgentLocators;
import com.grupit.engine.util.FormatterLogger;
import com.grupit.module.user.web.gwt.client.pluggablefeatures.agent.useraction.NoteUserActionAgentLocatorWeb;

public class PoZit4Grupit implements EntryPoint {

	private static final FormatterLogger logger = FormatterLogger.getLogger(PoZit4Grupit.class);

	@Override
	public void onModuleLoad() {
		logger.info("Iniciando carga del módulo PoZit...");

		NoteUserActionAgentLocatorWeb poZitUserActions = GWT.create(NoteUserActionAgentLocatorWeb.class);
		AgentLocatorCollection<String, PluggableFeatureAgent> userActionAgentLocators = UserWebAgentLocators.get()
				.getUserActionAgentLocators();

		try {
			userActionAgentLocators.registerAgentLocator(poZitUserActions);
		} catch (AgentLocatorCollectionException e) {
			GWT.getUncaughtExceptionHandler().onUncaughtException(e);
		} catch (InvalidCapabilityActionIdException e) {
			GWT.getUncaughtExceptionHandler().onUncaughtException(e);
		}

		logger.info("... módulo PoZit cargado OK.");
	}

}
